package com.bytedance.scene.ui.view.ext;


import ohos.agp.components.AttrSet;
import ohos.agp.components.Component;
import ohos.agp.render.BlurDrawLooper;
import ohos.agp.render.Canvas;
import ohos.agp.render.Paint;
import ohos.agp.utils.Color;
import ohos.agp.utils.Rect;
import ohos.app.Context;

public class CustomShadow extends Component implements Component.DrawTask {
    private Paint mPaint;
    private Rect mRect;

    public CustomShadow(Context context) {
        this(context,null);
    }

    public CustomShadow(Context context, AttrSet attrSet) {
        this(context, attrSet,null);
    }

    public CustomShadow(Context context, AttrSet attrSet, String styleName) {
        super(context, attrSet, styleName);
        mPaint=new Paint();
        mPaint.setAntiAlias(true);
        mPaint.setStyle(Paint.Style.FILL_STYLE);
        addDrawTask(this);
    }




    @Override
    public void onDraw(Component component, Canvas canvas) {
        mPaint.setBlurDrawLooper(new BlurDrawLooper(20,0,0,new Color(Color.getIntColor("#000000"))));

        mRect=new Rect(0,0,getWidth(),getHeight()-20);
        canvas.drawRect(mRect,mPaint);
    }
}
